Essential MATLAB for Engineers and Scientists by Brian Hahn & Daniel T. Valentine
Author:Brian Hahn & Daniel T. Valentine
Language: eng
Format: epub
ISBN: 9780081008775
Publisher: Elsevier Science
Published: 2016-09-09T04:00:00+00:00
Figure 8.1 Projectile trajectory.
Note also the use of an if inside the while loop to ensure that only co-ordinates of points above the ground are added to the vectors xp and yp.
If you want the last point above the ground to be closer to the ground, try a smaller value of dt, e.g., 0.01.
8.2.6. break and continue
Any loop structure you are likely to encounter in scientific programming can be coded with either ‘pure’ for or while loops, as illustrated by the examples in this chapter. However, as a concession to intellectual laziness I feel obliged to mention in passing the break and continue statements.
If there are a number of different conditions to stop a while loop you may be tempted to use a for with the number of repetitions set to some accepted cut-off value (or even Inf) but enclosing if statements which break out of the for when the various conditions are met. Why is this not regarded as the best programming style? The reason is simply that when you read the code months later you will have to wade through the whole loop to find all the conditions to end it, rather than see them all paraded at the start of the loop in the while clause.
If you are going to insist on using break you will have to look it up in help for yourself!
The continue statement is somewhat less virulent than break …
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Automotive | Engineering |
Transportation |
Whiskies Galore by Ian Buxton(41506)
Introduction to Aircraft Design (Cambridge Aerospace Series) by John P. Fielding(32874)
Small Unmanned Fixed-wing Aircraft Design by Andrew J. Keane Andras Sobester James P. Scanlan & András Sóbester & James P. Scanlan(32554)
Craft Beer for the Homebrewer by Michael Agnew(17916)
Turbulence by E. J. Noyes(7679)
The Complete Stick Figure Physics Tutorials by Allen Sarah(7114)
Kaplan MCAT General Chemistry Review by Kaplan(6562)
The Thirst by Nesbo Jo(6420)
Bad Blood by John Carreyrou(6257)
Modelling of Convective Heat and Mass Transfer in Rotating Flows by Igor V. Shevchuk(6214)
Learning SQL by Alan Beaulieu(6009)
Weapons of Math Destruction by Cathy O'Neil(5802)
Man-made Catastrophes and Risk Information Concealment by Dmitry Chernov & Didier Sornette(5618)
Digital Minimalism by Cal Newport;(5350)
Life 3.0: Being Human in the Age of Artificial Intelligence by Tegmark Max(5164)
iGen by Jean M. Twenge(5141)
Secrets of Antigravity Propulsion: Tesla, UFOs, and Classified Aerospace Technology by Ph.D. Paul A. Laviolette(4890)
Design of Trajectory Optimization Approach for Space Maneuver Vehicle Skip Entry Problems by Runqi Chai & Al Savvaris & Antonios Tsourdos & Senchun Chai(4829)
Electronic Devices & Circuits by Jacob Millman & Christos C. Halkias(4724)
